package com.kittlen.managementSystem.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.kittlen.managementSystem.entity.Student;
import com.kittlen.managementSystem.entity.Vehicle;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 车辆表 Mapper 接口
 * </p>
 *
 * @author kittlen
 * @since 2021-01-26
 */
public interface VehicleMapper extends BaseMapper<Vehicle> {
    @Select("select v.*,c.photo,c.fullname,c.agender,c.phone,c.email,c.is_end,c.joining_time,c.teaching_stage from t_vehicle v LEFT JOIN t_coach as c on v.coach_id=c.coach_id ${ew.customSqlSegment}")
    List<Vehicle> selects(@Param(Constants.WRAPPER) Wrapper wrapper);

    int insert(@Param("vehicle")Vehicle vehicle);

    //车辆导入
    int batchInsert(List<Vehicle> list);

    @Select("select count(*) from t_vehicle v LEFT JOIN t_coach as c on v.coach_id=c.coach_id ${ew.customSqlSegment}")
    int count(@Param(Constants.WRAPPER) Wrapper wrapper);

}
